# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.NetworkPeering do
  @moduledoc """
  A network peering attached to a network resource. The message includes the peering name, peer network, peering state, and a flag indicating whether Google Compute Engine should automatically create routes for the peering.

  ## Attributes

  *   `autoCreateRoutes` (*type:* `boolean()`, *default:* `nil`) - This field will be deprecated soon. Use the exchange_subnet_routes field instead. Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state is ACTIVE.
  *   `exchangeSubnetRoutes` (*type:* `boolean()`, *default:* `nil`) - Indicates whether full mesh connectivity is created and managed automatically between peered networks. Currently this field should always be true since Google Compute Engine will automatically create and manage subnetwork routes between two networks when peering state is ACTIVE.
  *   `exportCustomRoutes` (*type:* `boolean()`, *default:* `nil`) - Whether to export the custom routes to peer network. The default value is false.
  *   `exportSubnetRoutesWithPublicIp` (*type:* `boolean()`, *default:* `nil`) - Whether subnet routes with public IP range are exported. The default value is true, all subnet routes are exported. IPv4 special-use ranges are always exported to peers and are not controlled by this field.
  *   `importCustomRoutes` (*type:* `boolean()`, *default:* `nil`) - Whether to import the custom routes from peer network. The default value is false.
  *   `importSubnetRoutesWithPublicIp` (*type:* `boolean()`, *default:* `nil`) - Whether subnet routes with public IP range are imported. The default value is false. IPv4 special-use ranges are always imported from peers and are not controlled by this field.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of this peering. Provided by the client when the peering is created. The name must comply with RFC1035. Specifically, the name must be 1-63 characters long and match regular expression `[a-z]([-a-z0-9]*[a-z0-9])?`. The first character must be a lowercase letter, and all the following characters must be a dash, lowercase letter, or digit, except the last character, which cannot be a dash.
  *   `network` (*type:* `String.t`, *default:* `nil`) - The URL of the peer network. It can be either full URL or partial URL. The peer network may belong to a different project. If the partial URL does not contain project, it is assumed that the peer network is in the same project as the current network.
  *   `peerMtu` (*type:* `integer()`, *default:* `nil`) - Maximum Transmission Unit in bytes.
  *   `stackType` (*type:* `String.t`, *default:* `nil`) - Which IP version(s) of traffic and routes are allowed to be imported or exported between peer networks. The default value is IPV4_ONLY.
  *   `state` (*type:* `String.t`, *default:* `nil`) - [Output Only] State for the peering, either `ACTIVE` or `INACTIVE`. The peering is `ACTIVE` when there's a matching configuration in the peer network.
  *   `stateDetails` (*type:* `String.t`, *default:* `nil`) - [Output Only] Details about the current state of the peering.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :autoCreateRoutes => boolean() | nil,
          :exchangeSubnetRoutes => boolean() | nil,
          :exportCustomRoutes => boolean() | nil,
          :exportSubnetRoutesWithPublicIp => boolean() | nil,
          :importCustomRoutes => boolean() | nil,
          :importSubnetRoutesWithPublicIp => boolean() | nil,
          :name => String.t() | nil,
          :network => String.t() | nil,
          :peerMtu => integer() | nil,
          :stackType => String.t() | nil,
          :state => String.t() | nil,
          :stateDetails => String.t() | nil
        }

  field(:autoCreateRoutes)
  field(:exchangeSubnetRoutes)
  field(:exportCustomRoutes)
  field(:exportSubnetRoutesWithPublicIp)
  field(:importCustomRoutes)
  field(:importSubnetRoutesWithPublicIp)
  field(:name)
  field(:network)
  field(:peerMtu)
  field(:stackType)
  field(:state)
  field(:stateDetails)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.NetworkPeering do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.NetworkPeering.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.NetworkPeering do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
